package com.thread.wait;

/**
 * @author wangyingjie
 * @date
 * @remark
 */
public class VolidateDemo {

    private volatile static boolean ready;

    private volatile static int number;


    public static class ReadThread extends Thread{

        @Override
        public void run() {
            System.out.println("run...");
            while (!ready){
                System.out.println(number);
                if (number>0){
                    break;
                }
            }
        }
    }

    public static void main(String[] args) throws InterruptedException {
        Thread thread = new ReadThread();
        thread.start();
        Thread.sleep(1000);
        number = 11;
        ready = false;
        Thread.sleep(2000);
    }
}
